//
//  YunDanTrackViewController.m
//  阿帕
//
//  Created by mac on 2020/1/8.
//  Copyright © 2020 GCY. All rights reserved.
//

#import "YunDanTrackViewController.h"

#import "YunDanTrackCell.h"

@interface YunDanTrackViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (strong , nonatomic)UITableView *tableView;

//@property (strong , nonatomic)NSMutableArray *dataArray;

@property (strong , nonatomic)UIImageView *foundImageView;

@end

static NSString *const cellID = @"cellID";

static const CGFloat cellHeight = 90;

@implementation YunDanTrackViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [self setupBaseView];
    
}

- (void)setupBaseView {
    
    self.navigationItem.title = @"运单轨迹";
    
    self.view.backgroundColor = BackgroundColor;
    
    [self.view addSubview:self.tableView];
}


#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.trackArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    YunDanTrackCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    cell.model = self.trackArray[indexPath.row];
    
    if (indexPath.row == 0) {
        cell.desLabel.textColor = Theme_ColorValue;
        cell.dateLabel.textColor = Theme_ColorValue;
        cell.vLineView.backgroundColor = Theme_ColorValue;
        cell.stepNumLabel.backgroundColor = Theme_ColorValue;
    } else {
        cell.desLabel.textColor = Light_TextColor;
        cell.dateLabel.textColor = Light_TextColor;
        cell.vLineView.backgroundColor = Light_TextColor;
        cell.stepNumLabel.backgroundColor = Light_TextColor;
    }
    
    return cell;
}

#pragma mark - UITableViewDelegate

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return cellHeight;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.001f;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
}

#pragma mark - LazyLoad
- (UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.frame = CGRectMake(0, 10, ScreenW, ScreenH - NavHeight - MenuBarHeight - 10);
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.backgroundColor = [UIColor whiteColor];
        //注册单元格
        [_tableView registerNib:[UINib nibWithNibName:NSStringFromClass([YunDanTrackCell class]) bundle:nil] forCellReuseIdentifier:cellID];
    }
    
    return _tableView;
}

//- (NSMutableArray *)dataArray {
//    if (!_dataArray) {
//        _dataArray = [[NSMutableArray alloc] init];
//    }
//    return _dataArray;
//}

- (UIImageView *)foundImageView {
    if (!_foundImageView) {
        _foundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 170, 170)];
        _foundImageView.image = image(@"gcy_img_list_found");
        _foundImageView.contentMode = UIViewContentModeScaleAspectFit;
        _foundImageView.center = self.view.center;
        [self.view addSubview:_foundImageView];
    }
    return _foundImageView;
}

@end
